package com.djp.computerServer.controller;

import com.djp.computerServer.bean.Store;
import com.djp.computerServer.service.StoreService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/store")
public class StoreController extends BaseController<StoreService>{
    @RequestMapping("/add")
    @ResponseBody
    public Map addStore(@RequestBody Store reqBody) {
        return buildMap("增加商店", service.add(reqBody));
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Map delStore(@RequestBody Store reqBody) {
        return buildMap("删除商店", service.delete(reqBody));
    }

    @RequestMapping("/update")
    @ResponseBody
    public Map updateStore(@RequestBody Store reqBody) {
        return buildMap("更新商店", service.add(reqBody));
    }

    @RequestMapping("/getAll")
    @ResponseBody
    public Map getAllStore() {
        return buildMap("获取全部商店", service.getAll());
    }

    @RequestMapping("/getOne")
    @ResponseBody
    public Map getOneStore(@RequestBody Store reqBody) {
        return buildMap("获取一个商店", service.getOne(reqBody));
    }
}
